package com.ruoyi.comn.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.comn.mapper.ComnUserGroupMapper;
import com.ruoyi.comn.domain.ComnUserGroup;
import com.ruoyi.comn.service.IComnUserGroupService;

/**
 * 人员分组Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-11-29
 */
@Service
public class ComnUserGroupServiceImpl implements IComnUserGroupService 
{
    @Autowired
    private ComnUserGroupMapper comnUserGroupMapper;

    /**
     * 查询人员分组
     * 
     * @param userGroupUuid 人员分组主键
     * @return 人员分组
     */
    @Override
    public ComnUserGroup selectComnUserGroupByUserGroupUuid(String userGroupUuid)
    {
        return comnUserGroupMapper.selectComnUserGroupByUserGroupUuid(userGroupUuid);
    }

    /**
     * 查询人员分组列表
     * 
     * @param comnUserGroup 人员分组
     * @return 人员分组
     */
    @Override
    public List<ComnUserGroup> selectComnUserGroupList(ComnUserGroup comnUserGroup)
    {
        return comnUserGroupMapper.selectComnUserGroupList(comnUserGroup);
    }

    /**
     * 新增人员分组
     * 
     * @param comnUserGroup 人员分组
     * @return 结果
     */
    @Override
    public int insertComnUserGroup(ComnUserGroup comnUserGroup)
    {
        comnUserGroup.setCreateBy(SecurityUtils.getUsername());
        comnUserGroup.setCreateTime(DateUtils.getNowDate());
        return comnUserGroupMapper.insertComnUserGroup(comnUserGroup);
    }

    /**
     * 修改人员分组
     * 
     * @param comnUserGroup 人员分组
     * @return 结果
     */
    @Override
    public int updateComnUserGroup(ComnUserGroup comnUserGroup)
    {
        comnUserGroup.setUpdateBy(SecurityUtils.getUsername());
        comnUserGroup.setUpdateTime(DateUtils.getNowDate());
        return comnUserGroupMapper.updateComnUserGroup(comnUserGroup);
    }

    /**
     * 批量删除人员分组
     * 
     * @param userGroupUuids 需要删除的人员分组主键
     * @return 结果
     */
    @Override
    public int deleteComnUserGroupByUserGroupUuids(String[] userGroupUuids)
    {
        return comnUserGroupMapper.deleteComnUserGroupByUserGroupUuids(userGroupUuids);
    }

    /**
     * 删除人员分组信息
     * 
     * @param userGroupUuid 人员分组主键
     * @return 结果
     */
    @Override
    public int deleteComnUserGroupByUserGroupUuid(String userGroupUuid)
    {
        return comnUserGroupMapper.deleteComnUserGroupByUserGroupUuid(userGroupUuid);
    }
}
